package org.uim.cricket.storage.raise;

import org.uim.cricket.db.impl.ExistPlayer;
import org.uim.cricket.entities.Player;
import org.uim.cricket.entities.match.CricketMatch;
import org.uim.cricket.storage.Dlogger;
import org.uim.cricket.storage.StorageBeans;

public class CheckForPlayer {

	public String raisePlayer(CricketMatch match, Player p) throws Exception {
		if (p == null) return "";
		ExistPlayer exist = new ExistPlayer(p.getId(), p.getTitleName());
		if (!exist.exists()) {
			Dlogger.debug("  [New Player]: #" + p.getId() + " - " + p.getTitleName());
			return new InsertNewPlayer(StorageBeans.getInstance().fetchResObj(), match, p).raise();
		}
		return "";
	}
	
	
}
